//index.js
//获取应用实例
const app = getApp()
const date = new Date()
const provinceList = []
const letterList = []

var bmap = require('../../libs/bmap-wx.js');
var wxMarkerData = [];
for (let i = 1990; i <= date.getFullYear(); i++) {
  provinceList.push(i)
}

for (let i = 1; i <= 12; i++) {
  letterList.push(i)
}


Page({

  data: {
    grids: [0, 1, 2, 3, 4, 5,6],
    menuList: [
      { id: 1, text: '备案登记', imgclass: 'iconfont icon-registration', url: '/page-registration/home' },
      { id: 2, text: '操作证', imgclass: 'iconfont icon-operation', url: '/page-operation/operation' },
      { id: 3, text: '法律服务', imgclass: 'iconfont icon-legal', url: '/page-safe/home' },
      { id: 4, text: '保险金融', imgclass: 'iconfont icon-insurance', url: '/page-safe/home' },
      { id: 5, text: '设备评估', imgclass: 'iconfont icon-evaluation', url: '/page-safe/home' },
      { id: 6, text: '防伪查询', imgclass: 'iconfont icon-anti-fake', url: '/page-safe/home' },
      { id: 7, text: '测试按钮', imgclass: 'iconfont icon-anti-fake', url: '/page-wxRegister/wxRegister' },
    ],


    sliderList: [
      {
        selected: false, imageSource:
        'https://api.gcjxglzx.com/images/yizhong-wechat/videos/homePage.mp4', stype: false
      },
      { selected: true, imageSource: 'https://api.gcjxglzx.com/images/yizhong-wechat/background-img/advertisement3.png', stype: true },
      { selected: false, imageSource: 'https://api.gcjxglzx.com/images/yizhong-wechat/background-img/advertisement1.jpg', stype: true},
     
    ],
 
    newList: app.globalData.newList,


    markers: [],
    latitude: '',//纬度，范围为-90~90，负数表示南纬
    longitude: '',//经度，范围为-180~180，负数表示西经
    rgcData: {},
    province: '',//省
    city: '',//市
    district: '',//区、县
    street: '', //街道
    city_code: '',
  },

  //获取发票抬头
  invoiceFunction: function () {
    var a = 123;
    var b = "456";
    var c = "asd";
    var pushParam = '{"factoryNum":' + a + ',"identification":"' + b + '","changeIntoIdentification":"' + c + '"}';
    wx.redirectTo({
      //url: '/page-deviceVideo/deviceVideo'
      // url:'/page-deviceImg/home'
      url: "/page-receiveMessage/receiveMessage?pushParam=" + pushParam,
    })
  },


  chooseNew: function () {
    al
  },




  onLoad: function (options) {
    var that = this;
    

    /**
     * 百度地图获取当前的地理位置、速度
     */
    var BMap = new bmap.BMapWX({
      ak: app.globalData.ak //'您的ak'
    });
    var fail = function (data) {

    };
    var success = function (data) {
      console.log(data)
      wxMarkerData = data.wxMarkerData;
      that.setData({
        markers: wxMarkerData
      });
      console.log(wxMarkerData);
      that.setData({
        latitude: wxMarkerData[0].latitude
      });
      that.setData({
        longitude: wxMarkerData[0].longitude
      });
    }
    // 发起regeocoding检索请求 
    BMap.regeocoding({
      fail: fail,
      success: success,
      iconPath: '../../img/marker_red.png',
      iconTapPath: '../../img/marker_red.png'
    });

  },


  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },


  onShareAppMessage: function () {

  }
})


//  data中数据--图片地址
    // imageNew: '/images/new.png',
    // imagePeople: '/images/people.png',
    // imageMonitor: '/images/monitor.png',
    // imageShop: '/images/shop.png',
    // imagebutback: '/images/buttonbackground.png',
    // imageMonitor: '/images/monitor.png',
    // imageBank: '/images/banking.png',
    // imageSafe: '/images/safe.png',
    // imageOperation: '/images/operation.png',
    // imageTransfer: '/images/transfer.png',


    //data中数据--证件号或车牌号查询
    // certificatesList: [
    //   '证件号',
    //   '车牌号',
    // ],
    // indexCertificates: '0',

    // provinceList: [
    //   '京', '津', '黑', '吉', '辽', '冀', '豫', '鲁', '晋', '陕', '蒙', '宁', '新', '青', '藏', '鄂', '皖', '苏', '沪', '浙', '闵', '湘', '赣', '川', '渝', '贵', '云', '粤', '桂', '琼', '港', '澳','台'
    // ],
    // province: '蒙',

    // letterList: [
    //   'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
    // ],
    // letter: 'A',
    // proviceLetter:false,
    // zjh: true,
    // cph: false,
    // ownerName:''



 // 查询功能模块
  // provinceChange:function(e){
  //   this.setData({
  //     proviceLetter:true,
  //   });
  // },
  // provinceChange1: function (e) {
  //   this.setData({
  //     proviceLetter: false,
  //   });

  // },

  // bindChange: function (e) {
  //   const val = e.detail.value
  //   this.setData({
  //     province: this.data.provinceList[val[0]],
  //     letter: this.data.letterList[val[1]],

  //   })
  // },
  // certificatesChange: function (e) {
  //   var indexCertificates = e.detail.value
  //   this.setData({
  //     indexCertificates: e.detail.value,
  //   })
  //   if (indexCertificates == 0) {
  //     this.setData({
  //       zjh: true,
  //       cph: false,
  //     })
  //   }
  //   if (indexCertificates == 1) {
  //     this.setData({
  //       cph: true,
  //       zjh: false,
  //     })
  //   }
//   // },
// bankingFunction: function () {
//   if (this.data.zjh) {//获取到input输入框的值去查询证件号
//     if (this.data.ownerName != null && this.data.ownerName != '') {
//       //创建本地缓存zjh
//       var indexCertificates = this.data.indexCertificates;
//       wx.setStorageSync("zjh", this.data.ownerName);
//       wx.setStorageSync("cph", "");
//       wx.navigateTo({
//         url: '/page-banking/home'
//       })
//     }
//   }
//   if (this.data.cph) {//获取到input输入框的值去查询车牌号
//     if (this.data.ownerName != null && this.data.ownerName != '') {
//       //创建本地缓存zjh
//       var province = this.data.province
//       var letter = this.data.letter;
//       wx.setStorageSync("cph", province + letter + this.data.ownerName);
//       wx.setStorageSync("zjh", "");
//       wx.navigateTo({
//         url: '/page-banking/home'
//       })
//     }
//   }
// },



